package kernel.db.basics;


import java.sql.SQLException;
import java.sql.ResultSet;

public class Piecefournie extends DBOperator{

	/* ############################### Fields ############################### */
	private int IdPiece;

	private Faluchard IdFaluchard;

	/* ############################### Getters ############################## */
	public int getIdPiece(){
		return IdPiece;
	}

	public Faluchard getIdFaluchard(){
		return IdFaluchard;
	}

	/* ############################### Setters ############################## */
	public void setIdPiece(int newValue){
		this.IdPiece = newValue;
	}

	public void setIdFaluchard(Faluchard newValue){
		this.IdFaluchard = newValue;
	}

	/* ########################### CLASS CONSTRUCTORS ####################### */
	public Piecefournie(int IdFaluchard) throws SQLException {
		this.IdFaluchard = IdFaluchard;
		this.IdPiece = executeUpdate("INSERT INTO piecefournie VALUES('DEFAULT','"+IdFaluchard+"')");
	}

	public Piecefournie(int IdPiece, int IdFaluchard) throws SQLException {
		ResultSet rs = executeSelect("SELECT * FROM piecefournie WHERE IdPiece='"+IdPiece+"' AND IdFaluchard='"+IdFaluchard+"'");
				this.IdPiece = rs.getInt(IdPiece);
		this.IdFaluchard = rs.getInt(IdFaluchard);

	}
}